package work823;

import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.Arrays;

public class work2 {
  public static void main(String[] args) {
    String str = "https://www.baidu.com";
    try {
      URL url = new URL(str);
      InetAddress[] addresses = InetAddress.getAllByName(url.getHost());
      for (InetAddress address : addresses) {
        System.out.println(address.toString());
      }
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (UnknownHostException e) {
      e.printStackTrace();
    }
  }
}
